package com.itheima.mapper;

import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CheckGroupAndSetmealMapper {

    //根据setmealId查询关联的checkGroupId
    @Select("select group_id from group_setmeal where setmeal_id = #{setmealId}")
    public List<Integer> selectCheckGroupIdBySetmealId(Integer setmealId);

    //根据套餐Id查询check_group和check_item的信息
    Setmeal selectCheckGroupAndCheckItemBySetmealId(Integer setmealId);

    //根据checkGroupId和setmealId添加关联关系
    @Insert("insert into group_setmeal(group_id,setmeal_id) values(#{checkgroupId},#{setmealId})")
    void insert(Integer checkgroupId, Integer setmealId);

    //根据setmealId删除关联关系
    @Delete("delete from group_setmeal where setmeal_id = #{setmealId}")
    void delete(Integer setmealId);
}
